<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Banque - convertisseurs - validation croisée numéro de compte et catégorie</title>
<link rel="stylesheet" type="text/css"
	href="<%= request.getContextPath() %>/css/basic.css" />
</head>
<body>


<f:view>
    <f:verbatim><h2>Banque - convertisseurs - validation croisée numéro de compte et catégorie</h2></f:verbatim>
	<font color="red"><h:messages /></font>
	<br />
	<h:form>
		<f:verbatim>id:</f:verbatim>
		<h:inputText value="#{demobank.customers[0].id}" />
		<br />
		<f:verbatim>numéro de compte:</f:verbatim>
		<h:inputText id="numcompte" binding="#{demobank.numeroCompteInput}"
			value="#{demobank.customers[0].numCompte}" />
		<h:message for="numcompte" styleClass="error" showDetail="true" showSummary="false"/>
		<br />
		<f:verbatim>prénom:</f:verbatim>
		<h:inputText value="#{demobank.customers[0].forName}" />
		<br />
		<f:verbatim>nom:</f:verbatim>
		<h:inputText value="#{demobank.customers[0].name}" />
		<br />
		<f:verbatim>solde:</f:verbatim>
		<h:inputText value="#{demobank.customers[0].soldeCompte}"
			converter="#{Float}">
		</h:inputText>
		<br />
		<f:verbatim>date naissance:</f:verbatim>
		<h:inputText value="#{demobank.customers[0].dateNaissance}">
			<f:convertDateTime pattern="dd/MM/yyyy" />
		</h:inputText>
		<br />
		<f:verbatim>catégorie:</f:verbatim>
<h:panelGrid>
		<h:inputText id="categ" binding="#{demobank.categorieInput}"
			converter="#{Integer}" required="true"
			value="#{demobank.customers[0].categorie}">
			<f:validateLongRange minimum="1" maximum="9" />
		</h:inputText>
		<f:verbatim>(doit être  égal à 7)</f:verbatim>
</h:panelGrid>

		<h:message for="categ" styleClass="error" showDetail="true" showSummary="false"/>

		

		<h:dataTable binding="#{demobank.datatable}" value="#{demobank.customers}"
			var="customer" border="1">
			<h:column>
				<h:selectBooleanCheckbox binding="#{demobank.checkbox}" />
			</h:column>
			<h:column>
				<h:outputText value="#{customer.id}" />
			</h:column>
			<h:column>
				<h:outputText value="#{customer.numCompte}" />
			</h:column>

			<h:column>
				<h:outputText value="#{customer.name}" />
			</h:column>
			<h:column>
				<h:outputText value="#{customer.forName}" />
			</h:column>
			<h:column>
				<h:outputText value="#{customer.soldeCompte}">
					<f:convertNumber type="currency" />
				</h:outputText>
			</h:column>
			<h:column>
				<h:outputText value="#{customer.dateNaissance}">
					<f:convertDateTime pattern="dd/MM/yyyy" />
				</h:outputText>
			</h:column>
			<h:column>
				<h:outputText value="#{customer.categorie}"/>
			</h:column>

		</h:dataTable>

		<h:inputHidden id="validNumCompteCateg"
			validator="#{demobank.validerNumCompteCateg}" value="nul" />
		<h:message for="validNumCompteCateg" />

		<h:commandButton action="#{demobank.submit}" value="modifier" />
		<h:commandButton action="#{demobank.addCustomer}" value="ajouter" />
		<h:commandButton action="#{demobank.deleteCustomer}" value="supprimer" />
		<h:commandButton action="annuler" value="Annuler" immediate="true" />


	</h:form>
</f:view>




</body>
</html>